﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LowLevelGraphics.Filter
{
    /// <summary>
    /// Description
    /// J = stdfilt(I) returns the array J, 
    /// where each output pixel contains the standard deviation of the 3-by-3 neighborhood around the corresponding 
    /// pixel in the input image I. 
    /// I can have any dimension. 
    /// The output image J is the same size as the input image I.
    /// 
    /// For pixels on the borders of I, stdfilt uses symmetric padding. 
    /// In symmetric padding, the values of padding pixels are a mirror reflection of the border pixels in I.
    /// 
    /// J = stdfilt(I, NHOOD) calculates the local standard deviation of the input image I, 
    /// where you specify the neighborhood in NHOOD.
    /// NHOOD is a multidimensional array of zeros and ones where the nonzero elements specify the neighbors.
    /// NHOOD's size must be odd in each dimension.
    /// 
    /// By default, stdfilt uses the neighborhood ones(3). 
    /// stdfilt determines the center element of the neighborhood by floor((size(NHOOD) + 1)/2).
    /// 
    /// Class Support
    /// I can be logical or numeric and must be real and nonsparse.
    /// NHOOD can be logical or numeric and must contain zeros and/or ones. J is of class double.
    /// </summary>
    public class stdfilt : BaseImageFilter
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="stdfilt"/> class.
        /// </summary>
        public stdfilt()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="stdfilt"/> class.
        /// </summary>
        /// <param name="_stdfilt">The _stdfilt.</param>
        internal stdfilt(stdfilt _stdfilt)
        {
        }

        /// <summary>
        /// Execute this Filter
        /// A Debug Statement is written if a concrete Filter is called
        /// </summary>
        /// <param name="_bitmap"></param>
        /// <returns></returns>
        public override UnsafeBitmap Execute(UnsafeBitmap _bitmap)
        {
            return base.Execute(_bitmap);
        }

        /// <summary>
        /// This is used to clone a filter, each filter must implement it's own clone functionality
        /// </summary>
        /// <returns></returns>
        public override object Clone()
        {
            return new stdfilt(this);
        }
    }
}
